package reflect;

import java.util.Scanner;
/**
 * 使用类对象实例化
 */
public class ReflectDemo2 {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个类名:");
        String className = scanner.nextLine();
        Class cls = Class.forName(className);
        Object obj = cls.newInstance();
        System.out.println(obj);

    }
}
